home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Megahits 5
/
Megahits 5 (1994)(GTI - Rhein-Main-Soft)(DE)(Disc 2 of 2)[!].iso
/
archive
/
show
/
supervw_lib_82.lha
/
superview-lib
/
Programmers
/
include
/
superview
/
superview.h
next >
Wrap
C/C++ Source or Header
|
1994-09-10
|
12KB
|
358 lines
/* superview/superview.h */
/* Version : 7.1 */
/* Date : 16.07.1994 */
/* Written by : Andreas R. Kleinert */
#ifndef SUPERVIEW_SUPERVIEW_H
#define SUPERVIEW_SUPERVIEW_H
/* *************************************************** */
/* * * */
/* * Version Defines * */
/* * * */
/* *************************************************** */
#define SVLIB_VERSION 7
/* *************************************************** */
/* * * */
/* * Includes * */
/* * * */
/* *************************************************** */
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif /* EXEC_TYPES_H */
#ifndef LIBRARIES_DOS_H
#include <libraries/dos.h>
#endif /* LIBRARIES_DOS_H */
#ifndef _STDIO_H
#include <stdio.h>
#endif /* _STDIO_H */
#ifndef _STDLIB_H
#include <stdlib.h>
#endif /* _STDLIB_H */
#ifndef _STRING_H
#include <string.h>
#endif /* _STRING_H */
#ifndef SUPERVIEW_SVINFO_H
#include <superview/svinfo.h>
#endif /* SUPERVIEW_SVINFO_H */
/* *************************************************** */
/* * * */
/* * Custom Defines * */
/* * * */
/* *************************************************** */
#ifndef N
#define N NULL /* useful */
#endif /* N */
/* *************************************************** */
/* * * */
/* * MACROs for Version-Tests * */
/* * * */
/* *************************************************** */
#define LibVer(x) ( ((struct Library *) x)->lib_Version )
#define OS_VER LibVer(SysBase)
/* *************************************************** */
/* * * */
/* * DEFINES * */
/* * * */
/* *************************************************** */
/* Possible FileTypes */
#define SV_FILETYPE_NONE ((ULONG) 0)
#define SV_FILETYPE_UNKNOWN SV_FILETYPE_NONE
#define SV_FILETYPE_ILLEGAL ((ULONG) 0xFFFFFFFF)
#define SV_FILETYPE_ILBM ((ULONG) 1) /* IFF-ILBM, any derivat */
#define SV_FILETYPE_ACBM ((ULONG) 2) /* IFF-ACBM, any derivat */
#define SV_FILETYPE_DATATYPE ((ULONG) 3) /* V39-Datatype-Object */
/*
up to here : Constant codes for IFF-ILBM, IFF-ACBM and DataTypes
(constant for compatibility reasons).
above these : External, user defined FileSubTypes
(defined EACH TIME NEW at Library's startup-time).
*/
/* Possible SubTypes of FileTypes */
#define SV_SUBTYPE_NONE ((ULONG) 0)
#define SV_SUBTYPE_UNKNOWN SV_SUBTYPE_NONE
#define SV_SUBTYPE_ILLEGAL ((ULONG) 0xFFFFFFFF)
#define SV_SUBTYPE_ILBM ((ULONG) 1) /* Is IFF-ILBM */
#define SV_SUBTYPE_ILBM_01 ((ULONG) 2) /* Is IFF-ILBM, CmpByteRun1 */
#define SV_SUBTYPE_ACBM ((ULONG) 3) /* Is IFF-ACBM */
#define SV_SUBTYPE_DATATYPE ((ULONG) 4) /* Is V39-DataType-Object */
/*
up to here : Constant codes for IFF-ILBM, IFF-ACBM and DataTypes
(constant for compatibility reasons).
above these : External, user defined FileSubTypes
(defined EACH TIME NEW at Library's startup-time).
*/
/* Possible Input and Output mediums */
#define AKO_MEDIUM_NONE ((ULONG) 0) /* means : DEFAULT */
#define AKO_MEDIUM_ILLEGAL ((ULONG) 0xFFFFFFFF)
#define AKO_MEDIUM_DISK ((ULONG) 1) /* Read and Write media */
#define AKO_MEDIUM_CLIP ((ULONG) 2)
/* not any medium might be supported by any SVObject */
/* *************************************************** */
/* * * */
/* * Function Error Codes * */
/* * * */
/* *************************************************** */
#define SVERR_MAX_ERROR_TEXT_LENGTH (80) /* plus Null-Byte */
#define SVERR_NO_ERROR (NULL)
#define SVERR_INTERNAL_ERROR ((ULONG) 0xFFFFFFFF)
#define SVERR_UNKNOWN_FILE_FORMAT ((ULONG) 1)
#define SVERR_FILE_NOT_FOUND ((ULONG) 2)
#define SVERR_NO_MEMORY ((ULONG) 3)
#define SVERR_IFFPARSE_ERROR ((ULONG) 4)
#define SVERR_NO_CLIPBOARD ((ULONG) 5)
#define SVERR_NO_SCREEN ((ULONG) 6)
#define SVERR_NO_FILE ((ULONG) 7)
#define SVERR_NO_HANDLE ((ULONG) 8)
#define SVERR_NO_DATA ((ULONG) 9)
#define SVERR_GOT_NO_WINDOW ((ULONG) 10)
#define SVERR_GOT_NO_SCREEN ((ULONG) 11)
#define SVERR_NO_INFORMATION ((ULONG) 12)
#define SVERR_ILLEGAL_ACCESS ((ULONG) 13)
#define SVERR_DECODE_ERROR ((ULONG) 14)
#define SVERR_UNKNOWN_PARAMETERS ((ULONG) 15)
#define SVERR_ACTION_NOT_SUPPORTED ((ULONG) 16)
#define SVERR_VERSION_CONFLICT ((ULONG) 17)
#define SVERR_NO_DRIVER_AVAILABLE ((ULONG) 18)
/* Each new Library-Subversion may contain new Codes above
the last one of these.
So do not interpret the codes directly, but use
SVL_GetErrorString().
Maybe, newer Codes will not be listed up here.
*/
struct SV_GfxBuffer
{
/* All pointers (e.g. svgfx_Buffer) have to be and are AllocVec()'ed.
If you did not allocate SV_GfxBuffers by yourself, you must
neither free them nor do write-accesses to them.
If you allocated them by yourself, you also have to free them
by yourself - if no one else is still accessing them.
*/
ULONG svgfx_Version; /* structure version, see below */
ULONG svgfx_BufferType; /* Data organization, see below */
ULONG svgfx_Width; /* Graphic's Width */
ULONG svgfx_Height; /* Graphic's Height */
ULONG svgfx_ColorDepth; /* Graphic's ColorDepth */
ULONG svgfx_ViewMode32; /* if NULL, best ScreenMode is suggested */
/* (results in LowRes, if not changed). */
UBYTE svgfx_Colors[256][3]; /* For ColorDepth <= 8 : 3-Byte RGB entries */
/*
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
begin of "case-dependent" entries
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ONLY if svgfx_BufferType == SVGFX_BUFFERTYPE_BITPLANE, else NULL.
svgfx_BytesPerLine :
size of one row
of a plane in Bytes
= Bytes per Row : (( [width] +7)>>3)
Number of Rows per Plane : [height]
Number of Planes : [depth]
*/
ULONG svgfx_BytesPerLine; /* see above */
ULONG svgfx_PixelBits; /* see below */
/*
ONLY if svgfx_BufferType == SVGFX_BUFFERTYPE_ONEPLANE, else NULL.
svgfx_PixelBits :
Bits Per Pixel
(8, 16, 24, ...)
=> Bytes per Row : (svgfx_PixelBits>>3) * [width]
Number of Rows per Plane : [height]
Number of Planes : ONE
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
end of "case-dependent" entries
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*/
APTR svgfx_Buffer; /* any kind of memory (no chip ram needed) */
ULONG svgfx_BufferSize; /* if you want to copy it ... */
/* size of structure may grow in future versions : Check svgfx_Version ! */
};
#define SVGFX_VERSION (1)
#define SVGFX_BUFFERTYPE_BITPLANE (1) /* Amiga-like BitPlanes */
#define SVGFX_BUFFERTYPE_ONEPLANE (2) /* single Byte-/Word-/24 Bit-Plane */
/* there may be more types in the future */
/* (at least reject all types > 2) */
/*
Some words about interpreting and using SV_GfxBuffer structures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SVGFX_BUFFERTYPE_BITPLANE
=========================
SVGFX_BUFFERTYPE_BITPLANE means, that there's plane stored after plane,
but _no padding_ of the lines is done (e.g. to word- or longword-
boundaries), which is different from Amiga-BPs or ACBM-ABITs :
| line 1 of plane 1 | (each with svgfx_BytesPerLine)
| ... |
| line [height] of plane 1 |
...
| line 1 of plane [] |
| ... |
| line [height] of plane [] |
...
| line 1 of plane [depth] |
| ... |
| line [height] of plane [depth] |
SVGFX_BUFFERTYPE_BITPLANE is only used upto 256 Colors at the time :
16 and 24 Bit data will usually not be stored this way.
SVGFX_BUFFERTYPE_ONEPLANE
=========================
SVGFX_BUFFERTYPE_ONEPLANE means, that there's only one single plane stored.
The size of one pixel in this plane is defined in svgfx_PixelBits
(currently 8 for ChunkyPixel graphics or 24 for 24 Bit graphics).
| line 1 with ([PixelBits] / 8) * [width] Bytes |
| ... |
| line [height] with ([PixelBits] / 8) * [width] Bytes |
8 Bit : Chunky Pixel (ColorMap) = 8 ; ColorRegister index
16 Bit : R:G:B = 5:5:5:1 ; + 1 Bit Alpha Channel : IGNORED
24 Bit : R:G:B = 8:8:8 ; RGB-value
So 8 Bit Data contains [height] bytes in a row,
16 Bit Data contains [height]*2 bytes in a row
and 24 Bit Data contains [height]*3 bytes in a row.
Currently you will not find any SV_GfxBuffers with 16 Bit data,
but this may change in the future.
Differences, which perhaps are not obviously
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In SV_GfxBuffer structures there are two "case-dependent" entries
(see structure definition of SV_GfxBuffer) :
BITPLANE : svgfx_BytesPerLine = ( [width] +7 )>>3
svgfx_PixelBits = 0; ** IGNORE IT
svgfx_ColorDepth = [number of planes]
ONEPLANE : svgfx_BytesPerLine = 0; ** IGNORE IT
svgfx_PixelBits = 8; ** or == 24
svgfx_ColorDepth = [used PixelBits]
svgfx_ColorDepth always describes the _real_ ColorDepth of the graphics,
which means the stored number of planes for BITPLANE data and the number
of _actually_ used pixelbits for ONEPLANE data.
If svgfx_PixelBits is 24, svgfx_ColorDepth will perhaps always be 24, too.
But if svgfx_PixelBits is 8, it may be anything between 1 and 8.
The reason is, that e.g. GIF pictures are always stored 8 Bit-wide,
no matter if they contain 4, 8 or 256 Colors.
This is just because these 8 Bit are simply a ColorRegister index
(into the field of RGB-Colors : svgfx_Colors).
OK, there's no problem in displaying a ONEPLANE-8 graphics on a 256 Color
Screen, no matter which value svgfx_ColorDepth actually contains.
But if svgfx_ColorDepth is, let's say, only 4, this will be just a
waste of memory (and the last 256-16 = 240 colors will be black, anyway).
So finally we can say, that the data in a ONEPLANE SV_GfxBuffer is just
stored the same way, as e.g. in ChunkyPixel modes of VGA-like Graphic Cards
or in the source-buffers for GfxLibs's WritePixelLine8().
(See "graphics.library"'s AutoDocs for more information on ChunkyPixel
buffer (PixelLine8) handling under V37/39 with ECS/AGA.)
Which kind of data-storage is more likely ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ways of data-storage only depends the specific SVObjects.
Some Examples :
FileType BufferType PixelBits ColorDepth
GIF ONEPLANE 8 1..8
ILBM BITPLANE - 1..8
JPGE ONEPLANE 8/24 8/24
So any program, which supports GfxBuffers should handle both formats.
This is not difficult, since superviewsupport.library
contains functions to convert ONEPLANE buffers into BITPLANE buffers
and vice versa.
So you actually only have to support one of the data-storage alternatives.
(See Example-SourceCodes for more and detailed information !)
*/
#endif /* SUPERVIEW_SUPERVIEW_H */